import logbook
import sys
# 创建日志对象
logger = logbook.Logger('MyLogger')
# 设置日志级别
logger.level = logbook.INFO

# 添加日志处理器
stream_handler = logbook.StreamHandler(sys.stdout)
logger.handlers.append(stream_handler)

# 日志记录
logger.info('This is an info message')
logger.warning('This is a warning message')
logger.error('This is an error message')
